<?php
class CalendarAppModel extends AppModel {
    /**
     * 
     * Zwraca listę kolumn modelu
     * $fields = $this->ModelName->getModelColumns();
     * @param $model     * 
     */
    function getModelColumns(){
    	$_schema = $this->schema();
	    $fields = array();
		if(is_array($_schema)){
	    	foreach ($_schema as $column => $value) {
	    		array_push($fields,"{$this->name}.{$column}");
	    	}
	    }else{
	    	$fields = false;
	    }
	    return $fields;
    }
    
	/**
	 * uniqiname for uploaded file
	 * @param $fileName
	 */
	function uniqidFileName($fileName){
		preg_match("/\.([^\.]+)$/", $fileName, $matches);
		return uniqid('store_').'.'.$matches[1];
	}
}
?>